//
//  RNoteCell.m
//  Riji
//
//  Created by liujianlong on 2022/8/18.
//

#import "RNoteCell.h"
@interface RNoteCell()
@property (weak, nonatomic) IBOutlet UILabel *day;
@property (weak, nonatomic) IBOutlet UILabel *week;
@property (weak, nonatomic) IBOutlet UILabel *content;
@property (weak, nonatomic) IBOutlet UIButton *btn1;
@property (weak, nonatomic) IBOutlet UIButton *btn2;
@property (weak, nonatomic) IBOutlet UIButton *btn3;
@property (weak, nonatomic) IBOutlet UIButton *btn4;
@property (weak, nonatomic) IBOutlet UIImageView *img;

@end
@implementation RNoteCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.day.text = @"9";
    self.week.text = @"周二";
    self.content.text = @"今天很开心，没有想到能够得到这个奖励，感觉相当的荣幸，今后我会继续努力的！";
    [self.btn1 setTitle:@"00:00" forState:UIControlStateNormal];
    [self.btn2 setTitle:@"深圳市龙华区.宝安区，塘尾十一区好玩吗？" forState:UIControlStateNormal];
    [self.btn3 setTitle:@"晴" forState:UIControlStateNormal];
    [self.btn4 setTitle:@"开心开心" forState:UIControlStateNormal];

}
- (IBAction)actionForBtn:(UIButton *)sender {
    if (self.selectItem) {
        self.selectItem((int)sender.tag - 200);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setModel:(RNoteModel *)model{
    if (_model != model) {
        _model = model;
        self.day.text = model.day;
        self.week.text = [RNoteCell week:[model.week intValue]];
        self.content.text = model.content;
        [self.btn1 setTitle:model.time forState:UIControlStateNormal];
        [self.btn2 setTitle:LS(model.address) forState:UIControlStateNormal];
        [self.btn3 setTitle:LS(model.weather) forState:UIControlStateNormal];
        [self.btn4 setTitle:LS(model.feeling) forState:UIControlStateNormal];
        if (model.data.count > 0) {
            self.img.image = [UIImage imageWithData:model.data[0]];
        }
    }
}
+ (NSString *)week:(int)week{
    switch (week) {
        case 1:
            return LS(@"周日");
        case 2:
            return LS(@"周一");
        case 3:
            return LS(@"周二");
        case 4:
            return LS(@"周三");
        case 5:
            return LS(@"周四");
        case 6:
            return LS(@"周五");
        case 7:
            return LS(@"周六");
        default:
            return @"";;
    }
}
@end
